package
{
	import com.karst87.study.dowithbytes.chapter01.Chapter01;
	
	import flash.display.Sprite;
	
	import org.aswing.AsWingManager;
	import org.aswing.CenterLayout;
	import org.aswing.Container;
	import org.aswing.EmptyLayout;
	import org.aswing.FlowLayout;
	import org.aswing.JWindow;
	
	public class WhatCanYouDoWithBytes extends Sprite
	{
		public function WhatCanYouDoWithBytes()
		{
			initStage() ;
			createView() ;
		}
		
		
		private function initStage() : void
		{
			stage.frameRate = 40 ;
			AsWingManager.initAsStandard( this ) ;
		}
		
		private function createView() : void
		{
			createWindow() ;
			createChapter01() ;
		}
		
		private var window : JWindow = null ;
		private var pane : Container = null ;
		private function createWindow() : void
		{
			if( window == null )
			{
				window = new JWindow( this ) ;
				window.setSizeWH( stage.stageWidth, stage.stageHeight ) ;
			}
			if( pane == null )
			{
				pane = window.getContentPane() ;
				pane.setLayout( new CenterLayout() ) ;
			}
			window.show() ;
		}

		private var chapter01 : Chapter01 = null ;
		private function createChapter01() : void
		{
			if( chapter01 == null )
				chapter01 = new Chapter01() ;
			chapter01.setLayout( new EmptyLayout() ) ;
			chapter01.setSizeWH( stage.stageWidth, stage.stageHeight ) ;
			pane.append( chapter01 ) ;
		}

	}
}